package netty.nio;

import netty.common.Constant;

import java.io.*;
import java.nio.channels.FileChannel;

/**
 * @author cyt
 * @create 2020-11-04 14:29
 */
public class TestD {

    public static void main(String[] args) throws IOException {
        String filepath = Constant.FILEPATH;
        File file = new File(filepath + "cyt.png");
        File fileCopy = new File(filepath + "cytCopy.png");
        FileChannel input = new FileInputStream(file).getChannel();
        FileChannel out = new FileOutputStream(fileCopy).getChannel();
        out.transferFrom(input, 0, input.size());
        System.out.println(" trans from success!");
    }
}
